<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.one }" var="one" />
<jsp:useBean class="com.wsh.shop.users.pojo.AOrders" id="pojo"/>
<!DOCTYPE HTML>
<html>
    <head>
        <%@ include file="/common/include/title_back.jsp"%>
        <title>更新订单 - 美妆产品销售系统</title>
    </head>
    <body>
        <nav class="breadcrumb">
            <i class="Hui-iconfont">&#xe67f;</i> 首页 
            <span class="c-gray en">&gt;</span> 订单管理 
            <span class="c-gray en">&gt;</span> 更新订单
            <a class="btn btn-success radius r"
                style="line-height: 1.6em; margin-top: 3px"
                href="javascript:location.replace(location.href);" title="刷新">
                <i class="Hui-iconfont">&#xe68f;</i>
            </a>
        </nav>
        <article class="page-container">
            <form class="form form-horizontal" id="formSubmit" action="${rootPath }/back/OrdersBackServlet?method=ordersUpdateSubmit">
                <input type="hidden" name="operType" value="${param.operType }">
                <input type="hidden" name="id" value="${one.id }">
                <c:choose>
                    <c:when test="${one.status == '3'}">
                        <input type="hidden" name="status" value="4">
                        <!-- 已发货 -->
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span
                                class="c-red">*</span>物流公司：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
                                    <c:if test="${fn:startsWith(me.key,'LOGISTICSTYPE_')}">
                                        <!-- 拆分,按照-拆分,取最后一个 -->
                                        <c:set value="${fn:split(me.key, '-')}" var="keys"/>
                                        <div class="radio-box">
                                            <label for="${me.key }">
                                                <input type="radio" id="${me.key }" name="logisticsType" value="${keys[1] }" ${keys[1] == one.logisticsType ? 'checked' : '' }>
                                                &nbsp;${me.value }
                                            </label>
                                        </div>
                                    </c:if>
                                </c:forEach>
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span
                                class="c-red">*</span>物流单号：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="${one.logisticsSn }" placeholder=""
                                    id="logisticsSn" name="logisticsSn">
                            </div>
                        </div>
                    </c:when>
                    <c:otherwise>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2">状态：</label>
                            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                                <c:forEach items="${pojo.enumsMap }" var="me" varStatus="stat">
                                    <c:if test="${fn:startsWith(me.key,'STATUS')}">
                                        <!-- 拆分,按照-拆分,取最后一个 -->
                                        <c:set value="${fn:split(me.key, '-')}" var="keys"/>
                                        <c:if test="${keys[1] > one.status}">
                                            <div class="radio-box">
                                                <label for="${me.key }">
                                                    <input type="radio" id="${me.key }" name="status" value="${keys[1] }" ${keys[1] == one.status ? 'checked' : '' }>
                                                    &nbsp;${me.value }
                                                </label>
                                            </div>
                                        </c:if>
                                    </c:if>
                                </c:forEach>
                            </div>
                        </div>
                    </c:otherwise>
                </c:choose>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                        <button 
                            class="btn btn-primary radius" type="submit">
                            <i class="Hui-iconfont">&#xe632;</i> 提交
                        </button>
                        <!-- <button onClick="article_save();" class="btn btn-secondary radius"
                            type="button">
                            <i class="Hui-iconfont">&#xe632;</i> 保存草稿
                        </button>
                        <button onClick="removeIframe();" class="btn btn-default radius"
                            type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button> -->
                    </div>
                </div>
            </form>
        </article>
        <%@ include file="/common/include/footer_back.jsp" %>
        <script type="text/javascript">
            $(function(){
                $('.skin-minimal input').iCheck({
                    checkboxClass: 'icheckbox-blue',
                    radioClass: 'iradio-blue',
                    increaseArea: '20%'
                });
                
                //表单验证
                $("#formSubmit").validate({
                    rules:{
                        name:{
                            required:true,
                        },
                        capital:{
                            required:true,
                        },
                        stYear:{
                            required:true,
                            isDigits:true,
                        },
                        edYear:{
                            required:true,
                            isDigits:true,
                        }
                    },
                    onkeyup:false,
                    focusCleanup:true,
                    success:"valid",
                    submitHandler:function(form){
                        $(form).ajaxSubmit({
                            type: 'post',
                            success: function(data){
                                /* 弹出框 */
                                layer.msg(data.info,{icon:1,time:3000},function()
                                {
                                    if(data.code == '0')
                                    {
                                        //parent.$('.btn-refresh').click();
                                        /* 刷新父窗口 */
                                        window.parent.location.reload();
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    }
                                });
                            },
                            dataType:"json"
                        });
                    }
                });
                /* 初始化百度编辑器 */
                var ue = UE.getEditor('editor');
            });
        </script>
    </body>
</html>